package com.tbit.uqbike.client.service.impl;

import com.tbit.uqbike.client.dao.core.SendInvoiceLogDao;
import com.tbit.uqbike.client.pojo.SendInvoiceLog;
import com.tbit.uqbike.client.service.SendInvoiceLogService;

import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Objects;

/**
 * 发票发送日志表(SendInvoiceLog)表服务实现类
 *
 * @author shanyong.mo
 * @since 2025-04-02 10:25:57
 */
@Service("sendInvoiceLogService")
public class SendInvoiceLogServiceImpl implements SendInvoiceLogService {
    @Resource
    private SendInvoiceLogDao sendInvoiceLogDao;




    /**
     * 分页查询
     *
     * @param sendInvoiceLog 筛选条件
     * @param pageNum        页码
     * @param pageSize       每页数据量
     * @return 查询结果
     */
    @Override
    public List<SendInvoiceLog> queryByPage(SendInvoiceLog sendInvoiceLog, Integer pageNum,
                                            Integer pageSize) {
        return this.sendInvoiceLogDao.queryAllByLimit(sendInvoiceLog,
                Objects.nonNull(pageNum) && Objects.nonNull(pageSize) ? (pageNum - 1) * pageSize : null, pageSize);
    }


    /**
     * 查询总数
     *
     * @param sendInvoiceLog 筛选条件
     * @return 查询结果
     */
    @Override
    public Integer queryCount(SendInvoiceLog sendInvoiceLog) {
        return this.sendInvoiceLogDao.count(sendInvoiceLog);
    }

    /**
     * 新增数据（会判断null字段，null字段不插入）
     *
     * @param sendInvoiceLog 实例对象
     * @return 实例对象
     */
    @Override
    public SendInvoiceLog insertCheckNull(SendInvoiceLog sendInvoiceLog) {
        this.sendInvoiceLogDao.insertCheckNull(sendInvoiceLog);
        return sendInvoiceLog;
    }
}
